package mapper;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import pojo.User;

import java.util.List;
import java.util.Map;

public interface UserMapper {
    //添加
    void insertUser(User user);

    @Insert("insert into user values(null,#{usersname},#{password},#{name},#{work},#{interest},#{sex},#{remark},2)")
    void addUser(User user);
    User insertoff(String usersname);
    List<User> selectuserAll();
    User selectById(int id);
    //1散装参数
    //User selectLogin(@Param("usersname")String usersname,@Param("password")String password);
    // 2对象参数(对象属性名称要和参数占位符名称一致)
    //User selectLogin(User user);
    // 3map参数
    User selectLogin(User user);
    //多条件查询
    //动态sql查询
    User select(Map map);
    //修改
    void update(User user);
    //动态修改
    int updateplus(User user);
    //删除
    void deleteByid(int id);
    void deleteByids(@Param("ids") int[] ids);

    @Select("select * from user limit #{begin},#{size}")//分页
    List<User> selectByPage(@Param("begin") int begin,@Param("size")  int size);

    @Select("select count(*) from user")
    int selectCount();

    List<User> selectByPageAndCondition(@Param("begin") int begin,@Param("size")  int size,@Param("user") User user);


    int selectCountByCondition(User user);
}
